Skip to content

feat: implement filter node executor with support for deduplication, … - #85

Merged
Vamsi-o merged 1 commit into
mainfrom
creating-filter-node
Aug 5, 2026
Merged

feat: implement filter node executor with support for deduplication, …#85
Vamsi-o merged 1 commit into
mainfrom
creating-filter-node

Conversation

@Teja-Budumuru

@Teja-Budumuru Teja-Budumuru commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

…comparison, and GROUPING operations

Summary by CodeRabbit

  • New Features

    • Added a Group By operation to filter workflows.
    • Filter results can now be grouped by a selected source field, with empty-key rows tracked separately.
    • Added validation to require a source field when using Group By.
  • Bug Fixes

    • Node configuration defaults are now preserved and applied when selecting or loading a node.

Copilot AI lite review requested due to automatic review settings August 4, 2026 17:38
@Teja-Budumuru
Teja-Budumuru requested a review from Vamsi-o as a code owner August 4, 2026 17:38
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds the group_by filter operation to configuration and input validation. The executor groups rows by sourceKey and returns group metadata. ConfigModal now applies node field defaults when loading configuration.

Changes

Group-by filter support

Layer / File(s) Summary
Group-by operation contract
apps/web/app/lib/nodeConfigs/filter.action.ts, packages/common/src/index.ts
The filter configuration and FilterNodeInput schema accept the group_by operation.
Group-by execution
packages/nodes/src/filter/filter.executor.ts
FilterExecutor validates sourceKey, groups normalized rows, and returns group maps, arrays, counts, and empty-key metadata.
Node configuration defaults
apps/web/app/workflows/[id]/components/ConfigModal.tsx
Loaded configuration now receives missing node field defaults, is stored and dispatched, and reloads when the selected node ID changes. Existing spacing changes do not alter behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ConfigModal
  participant WorkflowState
  participant FilterExecutor
  ConfigModal->>ConfigModal: merge node field defaults
  ConfigModal->>WorkflowState: store and dispatch configuration
  WorkflowState->>FilterExecutor: submit group_by with sourceKey
  FilterExecutor->>WorkflowState: return grouped data and metadata
Loading

Possibly related PRs

  • Dev-Pross/BuildFlow#56: Changes the same ConfigModal.tsx configuration loading and per-node state handling.
  • Dev-Pross/BuildFlow#83: Introduces related changes to filter configuration, input validation, executor behavior, and ConfigModal.tsx.

Suggested reviewers: vamsi-o, copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the filter node executor and its support for deduplication, which matches the main pull request objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch creating-filter-node

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/app/lib/nodeConfigs/filter.action.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

apps/web/app/workflows/[id]/components/ConfigModal.tsx

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

packages/common/src/index.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

  • 1 others

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements a new group_by operation for the Filter node so workflows can group rows by a selected key, and updates the web UI to support additional node defaulting behavior and expose the new operation choice.

Changes:

  • Added group_by execution path in FilterExecutor, including grouped outputs and related metadata.
  • Extended shared Zod validation (FilterNodeInput) to allow the new group_by operation.
  • Updated the web UI config modal to apply field defaultValues when loading saved node configs, and added the new operation to the Filter node’s operation dropdown.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
packages/nodes/src/filter/filter.executor.ts Adds group_by executor logic and returns grouping results/metadata.
packages/common/src/index.ts Extends FilterNodeInput.operation enum with group_by.
apps/web/app/workflows/[id]/components/ConfigModal.tsx Applies node field defaults when loading configs; tweaks effect dependency.
apps/web/app/lib/nodeConfigs/filter.action.ts Adds group_by option to the Filter operation list in the UI.

Comment on lines +208 to +220
return {
success: true,
output: {
groupsMap: groupResult.groupMap,
groupsArray: groupResult.groupArray,
metadata: {
operation_used: operation,
total_groups: groupResult.groupArray.length,
items_processed: groupResult.total_processed,
items_without_key: groupResult.emptyCount
}
}
}
Comment on lines +119 to +123
private handleGroupBy(sourceData: any[], sourceKey: string) {
const groupMap: Record<string, any[]> = {};
let emptyCount = 0;
for (const item of sourceData) {
const key = this.normalizeValue(this.getValueByPath(item, sourceKey))
Comment on lines +376 to 380
setConfig(finalConfig);
dispatchConfig(finalConfig);

if (nodeConfig?.fields) {
for (const field of nodeConfig.fields) {
Comment on lines 15 to 20
options: [
{ label: "Remove Duplicates from Provided Data(Single List)", id: "unique_rows" },
{ label: "Find New Data Only (Compare Two Lists)", id: "new_data_only" },
{ label: "Find Existing Data Only (Compare Two Lists)", id: "existing_data_only" }
{ label: "Find Existing Data Only (Compare Two Lists)", id: "existing_data_only" },
{ label: "Group Data By Key", id: "group_by" },
],

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/nodes/src/filter/filter.executor.ts`:
- Around line 201-220: The group_by output contract is inconsistent between the
executor and node configuration. In packages/nodes/src/filter/filter.executor.ts
lines 201-220, establish the agreed group_by result shape and return its
groupsMap, groupsArray, and metadata fields; in
apps/web/app/lib/nodeConfigs/filter.action.ts lines 18-19, expose those same
fields by adding output entries or making outputSchema operation-aware. Keep
both layers aligned so grouping results are discoverable and downstream
references resolve correctly.
- Around line 119-130: Update handleGroupBy to initialize groupMap as a
prototype-free map so arbitrary normalized keys such as "__proto__",
"constructor", and "toString" are handled as ordinary groups. Preserve the
existing grouping and emptyCount behavior.
- Around line 201-206: Wrap the group_by case in the switch statement with
braces so the const groupResult declaration is scoped to that clause, while
preserving its existing logic and return behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ce523f06-9c67-446f-9ca8-2015e2a9f5c3

📥 Commits

Reviewing files that changed from the base of the PR and between 68e0666 and 5d1ad2e.

📒 Files selected for processing (4)
  • apps/web/app/lib/nodeConfigs/filter.action.ts
  • apps/web/app/workflows/[id]/components/ConfigModal.tsx
  • packages/common/src/index.ts
  • packages/nodes/src/filter/filter.executor.ts

Comment on lines +119 to +130
private handleGroupBy(sourceData: any[], sourceKey: string) {
const groupMap: Record<string, any[]> = {};
let emptyCount = 0;
for (const item of sourceData) {
const key = this.normalizeValue(this.getValueByPath(item, sourceKey))

if (key === "[EMPTY]") emptyCount++;

if (!groupMap[key]) {
groupMap[key] = []
}
groupMap[key].push(item)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Use a prototype-free map for arbitrary group keys.

groupMap is initialized with {}. For a normalized key such as "__proto__", "constructor", or "toString", the lookup returns an inherited object or function. groupMap[key].push(item) then throws, and the executor returns success: false for valid input.

Proposed fix
-        const groupMap: Record<string, any[]> = {};
+        const groupMap: Record<string, any[]> = Object.create(null);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private handleGroupBy(sourceData: any[], sourceKey: string) {
const groupMap: Record<string, any[]> = {};
let emptyCount = 0;
for (const item of sourceData) {
const key = this.normalizeValue(this.getValueByPath(item, sourceKey))
if (key === "[EMPTY]") emptyCount++;
if (!groupMap[key]) {
groupMap[key] = []
}
groupMap[key].push(item)
private handleGroupBy(sourceData: any[], sourceKey: string) {
const groupMap: Record<string, any[]> = Object.create(null);
let emptyCount = 0;
for (const item of sourceData) {
const key = this.normalizeValue(this.getValueByPath(item, sourceKey))
if (key === "[EMPTY]") emptyCount++;
if (!groupMap[key]) {
groupMap[key] = []
}
groupMap[key].push(item)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nodes/src/filter/filter.executor.ts` around lines 119 - 130, Update
handleGroupBy to initialize groupMap as a prototype-free map so arbitrary
normalized keys such as "__proto__", "constructor", and "toString" are handled
as ordinary groups. Preserve the existing grouping and emptyCount behavior.

Comment on lines +201 to +206
case 'group_by':
if (!sourceKey) return {
success: false,
error: "sourceKey is required to group datasets"
}
const groupResult = this.handleGroupBy(normalizedSource, sourceKey);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Wrap the group_by switch clause in braces.

Biome reports lint/correctness/noSwitchDeclarations for const groupResult at Line 206. Add a block around this case so the declaration is scoped only to group_by.

Proposed fix
-                case 'group_by':
+                case 'group_by': {
                     if (!sourceKey) return {
                         success: false,
                         error: "sourceKey is required to group datasets"
@@
                             }
                         }
                     }
+                }
                 default:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
case 'group_by':
if (!sourceKey) return {
success: false,
error: "sourceKey is required to group datasets"
}
const groupResult = this.handleGroupBy(normalizedSource, sourceKey);
case 'group_by': {
if (!sourceKey) return {
success: false,
error: "sourceKey is required to group datasets"
}
const groupResult = this.handleGroupBy(normalizedSource, sourceKey);
// existing group_by case body
}
default:
🧰 Tools
🪛 Biome (2.5.6)

[error] 206-206: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

(lint/correctness/noSwitchDeclarations)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nodes/src/filter/filter.executor.ts` around lines 201 - 206, Wrap
the group_by case in the switch statement with braces so the const groupResult
declaration is scoped to that clause, while preserving its existing logic and
return behavior.

Source: Linters/SAST tools

Comment on lines +201 to +220
case 'group_by':
if (!sourceKey) return {
success: false,
error: "sourceKey is required to group datasets"
}
const groupResult = this.handleGroupBy(normalizedSource, sourceKey);

return {
success: true,
output: {
groupsMap: groupResult.groupMap,
groupsArray: groupResult.groupArray,
metadata: {
operation_used: operation,
total_groups: groupResult.groupArray.length,
items_processed: groupResult.total_processed,
items_without_key: groupResult.emptyCount
}
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Align the group_by output contract across both layers.

The executor and node configuration do not publish the same result shape. This can hide grouping results from output discovery or break downstream references.

  • packages/nodes/src/filter/filter.executor.ts#L201-L220: define whether group_by uses an operation-specific shape or the common filter shape, then return the agreed fields.
  • apps/web/app/lib/nodeConfigs/filter.action.ts#L18-L19: add output entries for groupsMap, groupsArray, and the new metadata fields, or make outputSchema operation-aware.
🧰 Tools
🪛 Biome (2.5.6)

[error] 206-206: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.

(lint/correctness/noSwitchDeclarations)

📍 Affects 2 files
  • packages/nodes/src/filter/filter.executor.ts#L201-L220 (this comment)
  • apps/web/app/lib/nodeConfigs/filter.action.ts#L18-L19
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/nodes/src/filter/filter.executor.ts` around lines 201 - 220, The
group_by output contract is inconsistent between the executor and node
configuration. In packages/nodes/src/filter/filter.executor.ts lines 201-220,
establish the agreed group_by result shape and return its groupsMap,
groupsArray, and metadata fields; in
apps/web/app/lib/nodeConfigs/filter.action.ts lines 18-19, expose those same
fields by adding output entries or making outputSchema operation-aware. Keep
both layers aligned so grouping results are discoverable and downstream
references resolve correctly.

@Vamsi-o
Vamsi-o merged commit 36eb70b into main Aug 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants